<template>
    <div class='wrapper'>
        <navBar :navTitle="$t('Xuanzeyuyan')" />
        <van-radio-group v-model="locale" @change="localeChange">
            <van-cell-group>
                <van-cell v-for="(item, index) in type" clickable :key="item.value" :title="item.text">
                    <template #right-icon>
                        <van-radio :name="item.value" ref="checkboxes" />
                    </template>
                </van-cell>
            </van-cell-group>
        </van-radio-group>
    </div>
</template>

<script >
export default {
    name: "lan",
    data() {
        return {
            type: [{
                text: '简体中文',
                value: 'zh'
            }, {
                text: 'ภาษาไทย',
                value: 'tai'
            }, {
                text: 'English',
                value: 'ying'
            }, {
                text: '한국어',
                value: 'han'
            }, {
                text: '日本語',
                value: 'ri'
            }, {
                text: 'Français',
                value: 'fa'
            }],
            locale: localStorage.getItem('lang') || 'zh'
        };
    },
    methods: {
        localeChange() {
            console.log(this.locale)
            localStorage.setItem('lang', this.locale)
            this.$i18n.locale = this.locale
            window.location.reload()
        }
    },

};
</script>
<style lang='scss' scoped></style>